using Google.ProtocolBuffers;
using micromsg;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Network;
using MicroMsg.Protocol;
using MicroMsg.Storage;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneBase
	{
		private const string TAG = "NetSceneBase";
		protected SessionPack mSessionPack;
		public static BaseRequest makeBaseRequest(int scene)
		{
			BaseRequest.Builder builder = BaseRequest.CreateBuilder();
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount.nUin == 0u)
			{
				byte[] bytes = new byte[36];
				builder.SessionKey = ByteString.CopyFrom(bytes);
				builder.Uin = 0u;
			}
			else
			{
				builder.SessionKey = ByteString.CopyFrom(curAccount.bytesSessionkey);
				builder.Uin = curAccount.nUin;
			}
			builder.DeviceID = ByteString.CopyFromUtf8(Util.getDeviceUniqueId());
			builder.ClientVersion = (int)ConstantsProtocol.CLIENT_VERSION;
			builder.DeviceType = ByteString.CopyFrom(Util.toFixLenString(ConstantsProtocol.DEVICE_TYPE, 132));
			builder.Scene = (uint)scene;
			return builder.Build();
		}
		public void cancel()
		{
			if (this.mSessionPack != null)
			{
				Log.smethod_5("NetSceneBase", "do cancel scene... seq = " + this.mSessionPack.mSeqID);
				this.mSessionPack.mCanceled = true;
				this.mSessionPack = null;
			}
		}
	}
}
